#include<bits/stdc++.h>
using namespace std;
int main()
{
	string f, s;
	cin>>f>>s;
	if(f.size() < s.size())
		swap(f, s);
	f += f;
	if(f.find(s) != -1)
		cout<<"true";
	else
		cout<<"false";
    return 0;
}

